<!--
 * @Description: 订单列表搜索信息
 * @Version: 1.0
 * @Author: Yuanjy
 * @Date: 2020-03-31 12:04:35
 * @LastEditors: Yuanjy
 * @LastEditTime: 2020-05-15 12:15:07
 -->
<template>
  <div class="head-container">
    <!-- 搜索  -->
    <el-select v-model="query.principal" size="small" filterable placeholder="选择营养师" style="width: 200px;" class="filter-item">
      <el-option v-for="item in principals" :key="item.id" :label="item.name" :value="item.id" />
    </el-select>
    <el-input v-model="query.id" clearable placeholder="订单ID" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
    <el-input v-model="query.delivery_name" clearable placeholder="输入姓名" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
    <el-input v-model="query.nick_name" clearable placeholder="输入昵称" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
    <el-input v-model="query.phone" clearable placeholder="输入手机号码" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
    <el-select v-model="team" placeholder="团队" class="user-input" @change="selectTeam" v-if="teams.length!==0 && teams[0].role==='0'">
        <el-option key="" label="所有团队" value=""></el-option>
        <el-option
          v-for="item in teams"
          :key="item.id"
          :label="item.name"
          :value="item.id">
        </el-option>
      </el-select>
      <el-select v-model="principal" placeholder="营养师" class="user-input" v-if="teams.length!==0 && (teams[0].role==='0'||teams[0].role==='1')">
        <el-option key="" label="所有营养师" value=""></el-option>
        <el-option
          v-for="item in principals"
          :key="item.id"
          :label="item.name"
          :value="item.id">
        </el-option>
      </el-select>
      <el-date-picker
        v-model="order_time"
        type="date"
        placeholder="订单上传日期"
        class="user-input"
        format="yyyy-MM-dd">
      </el-date-picker>
      <el-select v-if="froms!==''" v-model="from" placeholder="客户来源" class="user-input">
        <el-option key="" label="客户来源" value=""></el-option>
        <el-option
          v-for="item in froms"
          :key="item"
          :label="item"
          :value="item">
        </el-option>
      </el-select>
      <el-select v-model="skustype" filterable placeholder="SKU类型" @change="changeSkutype" class="user-input">
        <el-option key="" label="SKU类型" value=""></el-option>
        <el-option
          v-for="item in skus"
          :key="item.key"
          :label="item.key"
          :value="item.key">
        </el-option>
      </el-select>
      <el-select v-model="skusname"  filterable @change="changeSkuname" placeholder="宝贝描述" class="user-input">
        <el-option key="" label="宝贝描述" value=""></el-option>
        <el-option
          v-for="item in skusdetail"
          :key="item.key"
          :label="item.key"
          :value="item.key">
        </el-option>
      </el-select>
      <el-select v-model="skusprice" filterable placeholder="宝贝价格" class="user-input">
        <el-option key="" label="宝贝价格" value=""></el-option>
        <el-option
          v-for="item in skusprices"
          :key="item"
          :label="item"
          :value="item">
        </el-option>
      </el-select>
      <el-input v-model="phone" placeholder="联系方式" class="user-input"></el-input>
      <!---<el-input v-model="number" placeholder="序号" class="user-input"></el-input><--->
      <el-input v-model="nick_name" placeholder="微信昵称" class="user-input"></el-input>
      <el-input v-model="delivery_name" placeholder="收货人姓名" class="user-input"></el-input>
      <!-- <el-input v-model="goods_title" placeholder="宝贝标题" class="user-input"></el-input> -->
      <el-input v-model="gene_no" placeholder="基因序号" class="user-input"></el-input>
    <el-button class="filter-item" size="mini" type="primary" icon="el-icon-search" @click="toQuery">搜索</el-button>
    <!-- 新增  -->
    <div style="display: inline-block;margin: 0px 2px;">
      <el-button
        class="filter-item"
        size="mini"
        type="primary"
        icon="el-icon-plus"
        @click="$refs.form.dialog = true">新增</el-button>
      <eForm ref="form" :is-add="true" :types="sup_this.types" :second-channels="sup_this.secondChannels" />
    </div>
  </div>
</template>

<script>
import eForm from './form'

export default {
  components: { eForm },
  props: {
    query: {
      type: Object,
      required: true
    },
    sup_this: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      principals: []
    }
  },
  mounted() {
    this.initParam()
  },
  methods: {
    initParam() {
      //获取当前管理员的部门成员信息
      this.$api.permission.user
        .getSubordinate()
        .then(res => {
          this.principals = res.data
        }).catch(err => {
          console.log(err)
        })
    },
    toQuery() {
      this.$parent.page = 0
      this.$parent.init()
    }
  }
}
</script>
